# matcher/base_matcher.py

from abc import ABC, abstractmethod
from typing import Dict, Any

class BaseMatcher(ABC):
    """匹配器基类，定义匹配接口"""
    
    @abstractmethod
    def match(self, resume: Dict[str, Any], jd: Dict[str, Any]) -> Dict[str, Any]:
        """
        执行简历与职位描述的匹配
        
        Args:
            resume: 简历数据字典
            jd: 职位描述数据字典
            
        Returns:
            匹配结果字典，包含总分、详细分数等
        """
        pass
    
    def _check_inputs(self, resume: Dict[str, Any], jd: Dict[str, Any]) -> None:
        """检查输入数据的有效性"""
        if not isinstance(resume, dict):
            raise ValueError("resume must be a dictionary")
        if not isinstance(jd, dict):
            raise ValueError("jd must be a dictionary")
        if "error" in resume:
            raise ValueError(f"resume contains error: {resume['error']}")
        if "error" in jd:
            raise ValueError(f"jd contains error: {jd['error']}") 